<template>
  <div class="task-finish-item" v-if="taskData">
    <div class="task-finish-item-left">
      <img
        :src="taskData.avatar"
        class="avadar"
        v-if="taskData.avatar"
      />
    </div>
    <div class="task-finish-item-right">
      <div class="task-top">
        <div class="task-creator">
          <div class="task-creator-info">
            <h3>
              {{taskData.userName}}<span>{{taskData.opDepartmentName}}</span>
            </h3>
            <div class="task-status">
              <span class="task-status-text text-blue" v-if="taskData.ac_status === 0">已接单</span>
              <span class="task-status-text text-blue" v-if="taskData.ac_status === 1">进行中</span>
              <span class="task-status-text text-gray" v-if="taskData.ac_status === 2">已取消</span>
              <span class="task-status-text text-green" v-if="taskData.ac_status === 3">已完成</span>
              <div class="task-submit" v-if="taskData.ac_adopt_status == 1" >
                <img
                  src="@/assets/images/seal-finish.png"
                  class="icon-seal"
                />
              </div>
            </div>
          </div>
          <fold-text class="detail-fold-text" :content="taskData.ac_finish_remak || taskData.ac_remak"></fold-text>
          <div class="log-imgs" v-if="taskData.taskacceptResourceList.length > 0">
              <MyImgs :imgData='taskData.taskacceptResourceList'></MyImgs>
            </div>
          <div class="ac_time">
            <span>{{Ac_statusForTime(taskData)}}</span>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { Button, Rate } from "vant";
import maps from "@/util/maps";
import FoldText from "@/components/foldText";
import MyImgs from "@/components/task/Imgs.vue";

export default {
  name: "logCard",
  components: {
    [Button.name]: Button,
    [Rate.name]: Rate,
    FoldText,
    MyImgs
  },
  props: {
    taskData: Object
  },
  data() {
    return {
      important_level: 0
    };
  },
  computed: {
    TaskType() {
      return this.taskData ? maps.taskTypeMap[this.taskData.task_type] : 0;
    },
    Ac_status() {
      return this.taskData ? maps.statusMap[this.taskData.ac_status]:'未接单';
    },
    // 根据订单状态显示状态与时间
    Ac_statusForTime() {
      return (item) => {
        return maps.getTimer(item);
      }
    },
    UrgentLevel() {
      return maps.urgentLevelMap[this.taskData.urgentLevel];
    }
  },
  mounted() {
    this.important_level = this.taskData ? this.taskData.important_level : 0;
  },
  methods: {}
};
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped lang="less">
.task-finish-item {
  background: #fff;
  border-top: 1PX solid #CCCCCC;
  padding: 30px;
  display: flex;
  &-left {
    width: 80px;
    margin-right: 20px;
    .avadar {
      width: 80px;
      height: 80px;
      border-radius: 8px;
    }
  }
  &-right {
    width:590px;
    text-align: left;
  }
}

.task-top {
  display: flex;
  justify-content: space-between;
  width: 100%;
  .task-creator {
    text-align: left;
    width: 100%;
    .detail-fold-text{
      margin:20px 0;
    }
    &-info{
      display: flex;
      justify-content: space-between;
    }
    h3 {
      font-size: 32px;
      color: #333;
      line-height: 1.2;
      margin-bottom: 10px;
      span {
        font-size: 24px;
        color: #999;
        margin-left: 20px;
        font-weight: normal;
      }
    }
    div.ac_time{
      display: flex;
      align-items: center;
      span {
        font-size: 24px;
        color: #999;
        margin-right: 20px;
      }
    }
  }
  .task-status {
    text-align: right;
    &-text {
      display: block;
      font-size: 26px;
      color: #00b500;
      margin-bottom: 14px;
      .text-blue{ color: #288EF4;}
      .text-green{color: #00B500;}
      .text-gray{ color: #999999;}
    }
    &-type {
      display: inline-block;
      font-size: 22px;
      color: #ec407a;
      background: #fbdce6;
      padding: 2px 8px;
      height: 34px;
      text-align: center;
      line-height: 34px;
      background: #fbdce6;
      border-radius: 4px;
    }
  }
}

.task-content {
  padding: 20px 0;
  &-text {
    font-size: 30px;
    text-align: left;
  }
  &-picture {
    margin-top: 30px;
    display: flex;
    &-item {
      width: 160px;
      height: 160px;
      margin-right: 16px;
      background: #eee;
      position: relative;
      img {
        position: absolute;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
        max-width: 100%;
        max-height: 100%;
      }
    }
  }
}

.task-receive-time {
  font-size: 24px;
  color: #999;
  margin-top: 20px;
}
.task-remark {
  margin-top: 20px;
  width: 600px;
}
.task-submit {
  background: #f7f7f7;
  padding: 20px;
  position: relative;
  margin-top: -20px;
  .icon-seal {
    z-index: 2;
    position: absolute;
    right: 0;
    top: 0;
    width: 108px;
    height: 108px;
  }
  &-text {
    font-size: 28px;
    color: #333;
    a {
      color: #576b95;
    }
  }
  &-picture {
    margin-top: 30px;
    display: flex;
    &-item {
      width: 160px;
      height: 160px;
      margin-right: 16px;
      background: #fff;
      position: relative;
      img {
        position: absolute;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
        max-width: 100%;
        max-height: 100%;
      }
    }
  }
}
.task-finish-time {
  font-size: 24px;
  color: #999;
  margin-top: 20px;
  display: flex;
}
</style>
